<!DOCTYPE html>



  


<html class="theme-next muse use-motion" lang="zh-CN">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="Hexo, NexT" />










<meta name="description" content="UIPickerView">
<meta property="og:type" content="article">
<meta property="og:title" content="UIPickerView自定义日期选择">
<meta property="og:url" content="http://yoursite.com/2018/12/20/UIPickerView/index.html">
<meta property="og:site_name" content="Erhqe">
<meta property="og:description" content="UIPickerView">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https://ws2.sinaimg.cn/large/006tNbRwly1fycxgicvmmj30nu0fuq4k.jpg">
<meta property="og:updated_time" content="2019-07-19T05:40:06.084Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="UIPickerView自定义日期选择">
<meta name="twitter:description" content="UIPickerView">
<meta name="twitter:image" content="https://ws2.sinaimg.cn/large/006tNbRwly1fycxgicvmmj30nu0fuq4k.jpg">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Muse',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: 'Author'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/2018/12/20/UIPickerView/"/>





  <title>UIPickerView自定义日期选择 | Erhqe</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Erhqe</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            Home
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            Categories
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            Archives
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2018/12/20/UIPickerView/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Erhqe">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/10.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Erhqe">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">UIPickerView自定义日期选择</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">Posted on</span>
              
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2018-12-20T08:40:00+08:00">
                2018-12-20
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">In</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/UIPickerView/" itemprop="url" rel="index">
                    <span itemprop="name">UIPickerView</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/2018/12/20/UIPickerView/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count valine-comment-count" data-xid="/2018/12/20/UIPickerView/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h3 id="UIPickerView"><a href="#UIPickerView" class="headerlink" title="UIPickerView"></a>UIPickerView<a id="more"></a></h3><blockquote>
<p><strong>项目要求: 时间选择范围本月今天当前时间当前分钟开始选择到本年年底,比如现在是08点49 那么显示选择时间是 08点50</strong></p>
</blockquote>
<p><img src="https://ws2.sinaimg.cn/large/006tNbRwly1fycxgicvmmj30nu0fuq4k.jpg" alt=""></p>
<h4 id="首先创建一个自定义View用来封装时间选择器"><a href="#首先创建一个自定义View用来封装时间选择器" class="headerlink" title="首先创建一个自定义View用来封装时间选择器"></a>首先创建一个自定义View用来封装时间选择器</h4><h5 id="定义用到的属性"><a href="#定义用到的属性" class="headerlink" title="定义用到的属性"></a>定义用到的属性</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br></pre></td><td class="code"><pre><span class="line">#define kTIMESTATUH 68 </span><br><span class="line">//#define kTIMESTATUH 68 * [UIScreen mainScreen].bounds.size.height / 736</span><br><span class="line"></span><br><span class="line">@interface DatePickerView ()&lt;UIPickerViewDelegate,UIPickerViewDataSource&gt;</span><br><span class="line"></span><br><span class="line">//  [NSString getCurrentMinute] &gt;= 50 有这种判断都是为了显示 0分, 比如显示是14 : 50 , 那么预约最快时间也是 14 : 60 ,但是这样显示不合理,需要15 : 00 显示合理</span><br><span class="line"></span><br><span class="line">/**时间选择*/</span><br><span class="line">@property(strong,nonatomic) UIPickerView *datePikerView;</span><br><span class="line"></span><br><span class="line">/**选择今天*/</span><br><span class="line">@property(assign,nonatomic,getter=isChooseToday) BOOL chooseToday;</span><br><span class="line"></span><br><span class="line">/**是否选择了现在时间 也就是 row = 0*/</span><br><span class="line">@property(assign,nonatomic,getter=isChooseHour) BOOL chooseHour;</span><br><span class="line"></span><br><span class="line">/**日期字符串*/</span><br><span class="line">@property(copy,nonatomic) NSString *dayString;</span><br><span class="line"></span><br><span class="line">/**时间字符串*/</span><br><span class="line">@property(copy,nonatomic) NSString *hourString;</span><br><span class="line"></span><br><span class="line">/**分钟字符串*/</span><br><span class="line">@property(copy,nonatomic) NSString *minuteString;</span><br><span class="line"></span><br><span class="line">/**取消按钮*/</span><br><span class="line">@property(strong,nonatomic) UIButton *cancelBtn;</span><br><span class="line"></span><br><span class="line">/**显示时间*/</span><br><span class="line">@property(strong,nonatomic) UILabel *showTime;</span><br><span class="line"></span><br><span class="line">/**确认*/</span><br><span class="line">@property(strong,nonatomic) UIButton *submit;</span><br><span class="line"></span><br><span class="line">/**选择预约时间提示*/</span><br><span class="line">@property(strong,nonatomic) UILabel *messageLabel;</span><br><span class="line"></span><br><span class="line">/**起点当地时间*/</span><br><span class="line">@property(strong,nonatomic) UILabel *timeLabel;</span><br><span class="line"></span><br><span class="line">/**日期数组*/</span><br><span class="line">@property(strong,nonatomic) NSMutableArray *dayArray;</span><br><span class="line"></span><br><span class="line">/**小时数组 今天的*/</span><br><span class="line">@property(strong,nonatomic) NSMutableArray *todayHourArray;</span><br><span class="line"></span><br><span class="line">/**默认时间数组*/</span><br><span class="line">@property(strong,nonatomic) NSMutableArray *defaultHourArray;</span><br><span class="line"></span><br><span class="line">/**今天当前时间的分钟数组*/</span><br><span class="line">@property(strong,nonatomic) NSMutableArray *currentHourMinArray;</span><br><span class="line"></span><br><span class="line">/**默认分钟数组*/</span><br><span class="line">@property(strong,nonatomic) NSMutableArray *defaultMinArray;</span><br><span class="line"></span><br><span class="line">/**DayIndex*/</span><br><span class="line">@property(assign,nonatomic) NSInteger dayIndex;</span><br><span class="line"></span><br><span class="line">/**HourIndex*/</span><br><span class="line">@property(assign,nonatomic) NSInteger hourIndex;</span><br><span class="line"></span><br><span class="line">/**MinIndex*/</span><br><span class="line">@property(assign,nonatomic) NSInteger minIndex;</span><br></pre></td></tr></table></figure>
<p><strong>初始化</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">- (instancetype)initWithFrame:(CGRect)frame&#123;</span><br><span class="line">    if (self == [super initWithFrame:frame]) &#123;</span><br><span class="line">//        60pt</span><br><span class="line">        //	默认是选择今天和 (一打开就是选择的今天)</span><br><span class="line">        self.chooseToday = YES;</span><br><span class="line">        // 是否选择了现在时间 也就是 row = 0</span><br><span class="line">        self.chooseHour = YES;</span><br><span class="line">        self.backgroundColor = [UIColor whiteColor];</span><br><span class="line">        </span><br><span class="line">        [self createUI];</span><br><span class="line"></span><br><span class="line">    &#125;</span><br><span class="line">    return self;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><strong>创建UI</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br></pre></td><td class="code"><pre><span class="line">#pragma mark - 创建UI</span><br><span class="line">- (void)createUI&#123;</span><br><span class="line">    self.cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];</span><br><span class="line">    [self.cancelBtn setTitle:@&quot;取消&quot; forState:UIControlStateNormal];</span><br><span class="line">    [self.cancelBtn setTitleColor:[UIColor colorWithRed:229 / 255.0 green:229 / 255.0 blue:299 / 255.0 alpha:1] forState:UIControlStateNormal];</span><br><span class="line">    [self.cancelBtn addTarget:self action:@selector(cancelClick) forControlEvents:UIControlEventTouchUpInside];</span><br><span class="line">    self.cancelBtn.titleLabel.font = [UIFont fontWithName:FONTNAME size:17];</span><br><span class="line">    </span><br><span class="line">    self.submit = [UIButton buttonWithType:UIButtonTypeCustom];</span><br><span class="line">    [self.submit setTitle:@&quot;确认&quot; forState:UIControlStateNormal];</span><br><span class="line">    self.submit.titleLabel.font = [UIFont fontWithName:FONTNAME size:17];</span><br><span class="line">    [self.submit addTarget:self action:@selector(submitClick) forControlEvents:UIControlEventTouchUpInside];</span><br><span class="line">    [self.submit setTitleColor:[UIColor colorWithRed:252 / 255.0 green:145 / 255.0 blue:83 / 255.0 alpha:1] forState:UIControlStateNormal];</span><br><span class="line">    </span><br><span class="line">    self.showTime = [[UILabel alloc]init];</span><br><span class="line">    self.showTime.font = [UIFont fontWithName:FONTNAME size:18];</span><br><span class="line">    self.showTime.textAlignment = NSTextAlignmentCenter;</span><br><span class="line">    </span><br><span class="line">    [self addSubview:self.cancelBtn];</span><br><span class="line">    [self addSubview:self.submit];</span><br><span class="line">    [self addSubview:self.showTime];</span><br><span class="line">    </span><br><span class="line">    UILabel *line = [[UILabel alloc]initWithFrame:CGRectMake(0, kTIMESTATUH - 0.5, [UIScreen mainScreen].bounds.size.width, 0.2)];</span><br><span class="line">    line.backgroundColor = [UIColor colorWithRed:229 / 255.0 green:229 / 255.0 blue:299 / 255.0 alpha:1];</span><br><span class="line">    [self addSubview:line];</span><br><span class="line">    </span><br><span class="line">    self.messageLabel = [[UILabel alloc]init];</span><br><span class="line">    self.messageLabel.text = @&quot;选择预约时间&quot;;</span><br><span class="line">    self.messageLabel.font = [UIFont fontWithName:FONTNAME size:18];</span><br><span class="line">    [self addSubview:self.messageLabel];</span><br><span class="line">    </span><br><span class="line">    self.timeLabel = [[UILabel alloc]init];</span><br><span class="line">    self.timeLabel.text = @&quot;(起点当地时间)&quot;;</span><br><span class="line">    self.timeLabel.textColor = [UIColor orangeColor];</span><br><span class="line">    self.timeLabel.font = [UIFont fontWithName:FONTNAME size:15];</span><br><span class="line">    [self addSubview:self.timeLabel];</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><strong>设置Frame</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line">#pragma mark - 设置Frame</span><br><span class="line">- (void)layoutSubviews&#123;</span><br><span class="line">    [super layoutSubviews];</span><br><span class="line">    self.datePikerView.frame = CGRectMake(0, kTIMESTATUH, self.frame.size.width, self.frame.size.height - kTIMESTATUH);</span><br><span class="line">    [self addSubview:self.datePikerView];</span><br><span class="line">    </span><br><span class="line">    </span><br><span class="line">    [self.cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) &#123;</span><br><span class="line">        make.left.equalTo(self).offset(16);</span><br><span class="line">        make.top.equalTo(self).offset(kTIMESTATUH / 2 - 18);</span><br><span class="line">        </span><br><span class="line">    &#125;];</span><br><span class="line">    </span><br><span class="line">    [self.submit mas_makeConstraints:^(MASConstraintMaker *make) &#123;</span><br><span class="line">        make.right.equalTo(self).offset(-16);</span><br><span class="line">        make.top.equalTo(self).offset(kTIMESTATUH / 2 - 18);</span><br><span class="line">    &#125;];</span><br><span class="line">    </span><br><span class="line">    [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) &#123;</span><br><span class="line">        make.centerX.equalTo(self.mas_centerX);</span><br><span class="line">        make.top.equalTo(@(11));</span><br><span class="line">    &#125;];</span><br><span class="line">    </span><br><span class="line">    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) &#123;</span><br><span class="line">        make.centerX.equalTo(self.messageLabel.mas_centerX);</span><br><span class="line">        make.top.equalTo(self.messageLabel.mas_bottom).offset(8);</span><br><span class="line">    &#125;];</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><strong>点击</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">#pragma mark - 取消点击</span><br><span class="line">- (void)cancelClick&#123;</span><br><span class="line">    if ([self.delegate respondsToSelector:@selector(cancelAndSubmit)]) &#123;</span><br><span class="line">        [self.delegate cancelAndSubmit];</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line">#pragma mark - 确认点击</span><br><span class="line">- (void)submitClick&#123;</span><br><span class="line">    if ([self.delegate respondsToSelector:@selector(cancelAndSubmit)]) &#123;</span><br><span class="line">        </span><br><span class="line">        NSString *dayString = self.dayArray[self.dayIndex];</span><br><span class="line">        </span><br><span class="line">        NSString *hourSreing = @&quot;&quot;;</span><br><span class="line">        if (self.dayIndex == 0) &#123;</span><br><span class="line">            hourSreing = self.todayHourArray[self.hourIndex];</span><br><span class="line">        &#125;else&#123;</span><br><span class="line">            hourSreing = self.defaultHourArray[self.hourIndex];</span><br><span class="line">        &#125;</span><br><span class="line">        </span><br><span class="line">        NSString *min = @&quot;&quot;;</span><br><span class="line">        if (self.dayIndex == 0 &amp; self.hourIndex == 0) &#123;</span><br><span class="line">            min = self.currentHourMinArray[self.minIndex];</span><br><span class="line">        &#125;else&#123;</span><br><span class="line">            min = self.defaultMinArray[self.minIndex];</span><br><span class="line">        &#125;</span><br><span class="line">        </span><br><span class="line">        dayString = [dayString stringByAppendingString:hourSreing];</span><br><span class="line">        dayString = [dayString stringByAppendingString:min];</span><br><span class="line">        </span><br><span class="line">        NSDictionary *dateDic = [NSDictionary dictionaryWithObject:dayString forKey:@&quot;info&quot;];</span><br><span class="line">        [[NSNotificationCenter defaultCenter] postNotificationName:SUBMITDATE object:nil userInfo:dateDic];</span><br><span class="line">        </span><br><span class="line">        [self.delegate cancelAndSubmit];</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><strong>UIPickerViewDelegate</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br></pre></td><td class="code"><pre><span class="line">#pragma mark - 内容视图</span><br><span class="line">- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view&#123;</span><br><span class="line">    UILabel *dateLabel = (UILabel *)view;</span><br><span class="line">    if (dateLabel == nil) &#123;</span><br><span class="line">        dateLabel = [[UILabel alloc]init];</span><br><span class="line">        dateLabel.textAlignment = NSTextAlignmentCenter;</span><br><span class="line">        dateLabel.font = [UIFont systemFontOfSize:14];</span><br><span class="line">    &#125;</span><br><span class="line">    </span><br><span class="line">    switch (component) &#123;</span><br><span class="line">        case 0:</span><br><span class="line">            dateLabel.text = self.dayArray[row];</span><br><span class="line">            break;</span><br><span class="line">        case 1:</span><br><span class="line">            if (self.isChooseToday) &#123;</span><br><span class="line">            dateLabel.text = self.todayHourArray[row];</span><br><span class="line">            &#125;else&#123;</span><br><span class="line">            dateLabel.text = self.defaultHourArray[row];</span><br><span class="line">            &#125;</span><br><span class="line">            break;</span><br><span class="line">        case 2:</span><br><span class="line">            </span><br><span class="line">            if (self.isChooseToday &amp; self.isChooseHour) &#123;</span><br><span class="line">                dateLabel.text = self.currentHourMinArray[row];</span><br><span class="line">            &#125;else&#123;</span><br><span class="line">                dateLabel.text = self.defaultMinArray[row];</span><br><span class="line">            &#125;</span><br><span class="line">            break;</span><br><span class="line">            </span><br><span class="line">    &#125;</span><br><span class="line">    return dateLabel;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><strong>UIPickerViewDataSource</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">#pragma mark - 返回行数</span><br><span class="line">- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component&#123;</span><br><span class="line">    if (component == 0) &#123;</span><br><span class="line">        </span><br><span class="line">        return self.dayArray.count;</span><br><span class="line">        </span><br><span class="line">    &#125;else if (component == 1)&#123;</span><br><span class="line">        if (self.isChooseToday) &#123;</span><br><span class="line">            return self.todayHourArray.count;</span><br><span class="line">        &#125;else&#123;</span><br><span class="line">            return 24;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;else&#123;      //分钟</span><br><span class="line">        if (self.isChooseHour &amp;&amp; self.isChooseToday) &#123;</span><br><span class="line">            return self.currentHourMinArray.count;</span><br><span class="line">        &#125;else&#123;</span><br><span class="line">            return 6;</span><br><span class="line">        &#125;</span><br><span class="line">        return 10;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">#pragma mark - 行高</span><br><span class="line">- (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component&#123;</span><br><span class="line">    return 35;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br></pre></td><td class="code"><pre><span class="line">#pragma mark - 被选择的行</span><br><span class="line">- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component&#123;</span><br><span class="line">    //  上一次选择的是 不是今天 不是则刷新</span><br><span class="line">    if (component == 0 &amp;&amp; row == 0) &#123;</span><br><span class="line">        self.chooseToday = YES;</span><br><span class="line">        [pickerView reloadComponent:1];</span><br><span class="line">        [pickerView reloadComponent:2];</span><br><span class="line">        </span><br><span class="line">    &#125;</span><br><span class="line">    //   上一次选择的是 今天 那么的刷新</span><br><span class="line">    if (component == 0 &amp;&amp; row != 0) &#123;</span><br><span class="line">        if (self.chooseToday) &#123;</span><br><span class="line">            self.chooseToday = NO;</span><br><span class="line">            [pickerView reloadComponent:1];</span><br><span class="line">            [pickerView reloadComponent:2];</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">    </span><br><span class="line">    /******************* 小时分钟 *************************/</span><br><span class="line">    if (component == 1 &amp;&amp; row == 0) &#123;</span><br><span class="line">        if (!self.chooseHour) &#123;</span><br><span class="line">            self.chooseHour = YES;</span><br><span class="line">            [pickerView reloadComponent:2];</span><br><span class="line">  </span><br><span class="line">            </span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">    if (component == 1 &amp;&amp; row != 0) &#123;</span><br><span class="line">        if (self.chooseHour) &#123;</span><br><span class="line">            self.chooseHour = NO;</span><br><span class="line">            [pickerView reloadComponent:2];</span><br><span class="line">            </span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">    </span><br><span class="line">    if (component == 0) &#123;</span><br><span class="line">        self.dayIndex = row;</span><br><span class="line">    &#125;</span><br><span class="line">    if (component == 1) &#123;</span><br><span class="line">        self.hourIndex = row;</span><br><span class="line">    &#125;</span><br><span class="line">    if (component == 2) &#123;</span><br><span class="line">        self.minIndex = row;</span><br><span class="line">    &#125;</span><br><span class="line">    </span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">#pragma mark - 返回指定列的宽度</span><br><span class="line">- (CGFloat) pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component&#123;</span><br><span class="line">    </span><br><span class="line">    if (component==0) &#123;</span><br><span class="line">        return  self.frame.size.width / 2;</span><br><span class="line">    &#125; else&#123;</span><br><span class="line">        return  self.frame.size.width / 4;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">#pragma mark - 几个分组</span><br><span class="line">- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView&#123;</span><br><span class="line">    return 3;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><strong>最主要的数据源设计</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br></pre></td><td class="code"><pre><span class="line">- (NSMutableArray *)dayArray&#123;</span><br><span class="line">    if (!_dayArray) &#123;</span><br><span class="line">        _dayArray = [NSMutableArray array];</span><br><span class="line">        NSInteger count = [NSString currentYearBeLeftHowManyDay];</span><br><span class="line">        for (int i = 0; i &lt; count; i++) &#123;</span><br><span class="line">            NSDate*nowDate = [NSDate date];</span><br><span class="line">            NSTimeInterval  interval =24*60*60*i; //  1 * row:天数</span><br><span class="line">            NSDate*date1 = [nowDate initWithTimeIntervalSinceNow:+interval];</span><br><span class="line">            NSString *dateString = i == 0 ? [NSString monthDayWeeks:date1 isToday:YES] : [NSString monthDayWeeks:date1 isToday:NO];</span><br><span class="line">            [_dayArray addObject:dateString];</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">    return _dayArray;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">- (NSMutableArray *)todayHourArray&#123;</span><br><span class="line">    if (!_todayHourArray) &#123;</span><br><span class="line">        _todayHourArray = [NSMutableArray array];</span><br><span class="line">        //   先获取当前时间</span><br><span class="line">        NSUInteger time = [NSString getCurrentHour];</span><br><span class="line">        //   在获取当前时间 是否拥有十分钟</span><br><span class="line">        NSUInteger min = [NSString getCurrentMinute];</span><br><span class="line">        </span><br><span class="line">        if (60 - min &gt; 10) &#123;</span><br><span class="line">            for (int i = 0; i &lt; 24 - time; i++) &#123;</span><br><span class="line">                [_todayHourArray addObject:[NSString stringWithFormat:@&quot;%02ld点&quot;,time + i]];</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;else&#123;</span><br><span class="line">            for (int i = 1; i &lt; 24 - time; i++) &#123;</span><br><span class="line">                [_todayHourArray addObject:[NSString stringWithFormat:@&quot;%02ld点&quot;,time + i]];</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">    return _todayHourArray;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">- (NSMutableArray *)defaultHourArray&#123;</span><br><span class="line">    if (!_defaultHourArray) &#123;</span><br><span class="line">        _defaultHourArray = [NSMutableArray array];</span><br><span class="line">        </span><br><span class="line">        for (int i = 0; i &lt; 24; i++) &#123;</span><br><span class="line">            [_defaultHourArray addObject:[NSString stringWithFormat:@&quot;%02d点&quot;,i]];</span><br><span class="line">        &#125;</span><br><span class="line">        </span><br><span class="line">    &#125;</span><br><span class="line">    return _defaultHourArray;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">- (NSMutableArray *)currentHourMinArray&#123;</span><br><span class="line">    if (!_currentHourMinArray) &#123;</span><br><span class="line">        _currentHourMinArray = [NSMutableArray array];</span><br><span class="line">        NSInteger min = [NSString getCurrentMinute];</span><br><span class="line">        </span><br><span class="line">        //  没有剩余10分钟   也就是 00分  10分 20分</span><br><span class="line">        if (min &gt;= 50) &#123;</span><br><span class="line">            for (int i = 0; i &lt; 6; i++) &#123;</span><br><span class="line">                [_currentHourMinArray addObject:[NSString stringWithFormat:@&quot;%02d分&quot;,i * 10]];</span><br><span class="line">                </span><br><span class="line">            &#125;</span><br><span class="line">        &#125;else&#123;</span><br><span class="line">            NSInteger count = 6 - min / 10;</span><br><span class="line">            for (int i = 1; i &lt; count ; i++) &#123;</span><br><span class="line">                [_currentHourMinArray addObject:[NSString stringWithFormat:@&quot;%02ld分&quot;,min + i * 10]];</span><br><span class="line">                </span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        </span><br><span class="line">    &#125;</span><br><span class="line">    return _currentHourMinArray;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">- (NSMutableArray *)defaultMinArray&#123;</span><br><span class="line">    if (!_defaultMinArray) &#123;</span><br><span class="line">        _defaultMinArray = [NSMutableArray array];</span><br><span class="line">        for (int i = 0; i &lt; 6; i++) &#123;</span><br><span class="line">            [_defaultMinArray addObject:[NSString stringWithFormat:@&quot;%02d分&quot;,i * 10]];</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">    return _defaultMinArray;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><a href="https://gitee.com/Min_amdrl/DatePicker.git" target="_blank" rel="noopener">Demo</a></p>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2018/12/17/签到UI实现/" rel="next" title="签到UI实现">
                <i class="fa fa-chevron-left"></i> 签到UI实现
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2019/01/08/OCCallSwift/" rel="prev" title="OCCallSwift">
                OCCallSwift <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  
    <div class="comments" id="comments">
    </div>
  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            Table of Contents
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            Overview
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="/images/10.png"
                alt="Erhqe" />
            
              <p class="site-author-name" itemprop="name">Erhqe</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">70</span>
                  <span class="site-state-item-name">posts</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                
                  <span class="site-state-item-count">31</span>
                  <span class="site-state-item-name">categories</span>
                
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                
                  <span class="site-state-item-count">1</span>
                  <span class="site-state-item-name">tags</span>
                
              </div>
            

          </nav>

          

          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#UIPickerView"><span class="nav-number">1.</span> <span class="nav-text">UIPickerView</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#首先创建一个自定义View用来封装时间选择器"><span class="nav-number">1.1.</span> <span class="nav-text">首先创建一个自定义View用来封装时间选择器</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#定义用到的属性"><span class="nav-number">1.1.1.</span> <span class="nav-text">定义用到的属性</span></a></li></ol></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Erhqe</span>

  
</div>


  <div class="powered-by">Powered by <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a></div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">Theme &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Muse</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  










  <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
  <script src="//unpkg.com/valine/dist/Valine.min.js"></script>
  
  <script type="text/javascript">
    var GUEST = ['nick','mail','link'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(item=>{
      return GUEST.indexOf(item)>-1;
    });
    new Valine({
        el: '#comments' ,
        verify: false,
        notify: false,
        appId: 'TiAY2J24ECwQH9uLYsoJpgIK-gzGzoHsz',
        appKey: 'Y9PiVrPXVmfNsv4Aa6cPsADG',
        placeholder: 'Just go go',
        avatar:'mm',
        guest_info:guest,
        pageSize:'10' || 10,
    });
  </script>



  





  

  

  

  
  

  

  

  

</body>
</html>
